package main

import "fmt"

func main() {
	a := [3][3]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
	b := [3][3]int{{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}
	c := [3][3]int{{}, {}, {}}
	d := [3][3]int{{}, {}, {}}

	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			c[i][j] = a[i][j] + b[i][j]
			for k := 0; k < 3; k++ {
				d[i][j] = a[i][k]*b[k][j] + d[i][j]
			}
		}
	}
	fmt.Printf("矩阵相加后的结果为%v\n", c)
	fmt.Printf("矩阵相乘后的结果为%v", d)
}
